var BFS = function(root) {
    let queue = []
    // 结果数组
    let arr = []
    queue.push(root)
    while (queue.length != 0) {
        let treeNode = queue.shift()
        arr.push(treeNode.val)
        if (treeNode.left !=null) {
            queue.push(treeNode.left)

        }
        if (treeNode.right != null) {
            queue.push(treeNode.right)
        }
    }
    return arr
}